<?php

namespace app\admin\validate;

use think\Validate;

class FromConfig extends Validate
{
    //字段规则
    protected $rule = [
        'name' => 'require',
        'title' => 'require',
        'category_id' => 'require',
        'type' => 'require'
    ];

    //验证器提示信息
    protected $message = [
        'name.require' => '变量名不能为空',
        'title.require' => '请输入标题',
        'category_id.require' => '请选择form配置的二级分类',
        'type.require' => '请输入表单类型',
    ];

    //使用场景
    protected $scene = [
        'index' => ['category_id'],
        'add' => ['name', 'title', 'category_id', 'type'],
        'edit' => ['name', 'title', 'category_id', 'type'],
    ];
}